<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>H+ 后台主题UI框架 - 基本表单</title>
    <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
    <meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">

    <link rel="shortcut icon" href="favicon.ico">
    <link href="css/bootstrap.min.css-v=3.3.5.css"
          tppabs="http://www.zi-han.net/theme/hplus/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="css/font-awesome.min.css-v=4.4.0.css"
          tppabs="http://www.zi-han.net/theme/hplus/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="css/plugins/iCheck/custom.css"
          tppabs="http://www.zi-han.net/theme/hplus/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="css/animate.min.css" tppabs="http://www.zi-han.net/theme/hplus/css/animate.min.css"
          rel="stylesheet">
    <link href="css/style.min.css-v=4.0.0.css" tppabs="http://www.zi-han.net/theme/hplus/css/style.min.css?v=4.0.0"
          rel="stylesheet">
    <!--    <base target="_blank">-->
    <link rel="stylesheet" type="text/css" href="./layui/css/layui.css"/>
    <style>
        #zhuti{
            height:100%;

        }
        #zhuti::before{
            background:  url('img/logo1.png')  no-repeat fixed center;
            content:"";
            opacity:0.2;//透明度设置
        z-index:-1;
            width:1000px;
            height:600px;
            position:absolute;
            /*top:0px;*/
            /*left:0px;*/
            /*border-radius:40px*/
        }
        #xiaohuiid{
            border-top: 0;
            padding-left: 20px;
            height:360px;
            background-color: #fff;
            margin-right: -15px;
            margin-left: -15px;
        }
    </style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">

    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins" id="zhuti">
                <div class="ibox-title">
                    <h3 style="font-weight: 600;margin-top: 0;">申请详情</h3>
                </div>
                <div class="ibox-content">
                    <div method="post" id="bigform" autocomplete="off" class="form-horizontal">
                        <div class="form-group" style="margin-bottom: 0px;">
                            <label class="col-sm-2 control-label">借用物品</label>
                            <!-- col-sm-4 m-l-n -->
                            <div class="col-sm-9">
                                <input id="hys" type="text" name="meetingname" required placeholder="请输入借用物品"
                                       class="form-control">
                            </div>
                        </div>
                        <br>
                        <div class="form-group" style="margin-bottom: 0px;">
                            <label class="col-sm-2 control-label">借用原因</label>
                            <div class="col-sm-9">
                                <input id="hymc" type="text" name="meetingname" required placeholder="请输入借用原因"
                                       class="form-control">
                            </div>
                        </div>
                        <br>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">申请人</label>
                            <div class="col-sm-3">
                                <input id="hynr" type="text" name="meetingneirong" placeholder="请输入申请方"
                                       class="form-control"
                                       required>
                            </div>

                            <label class="col-sm-2 control-label">申请人联系方式</label>
                            <div class="col-sm-4">
                                <input id="lxfs" type="text" name="teashu" required placeholder=""
                                       class="form-control">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">申请人所属学院</label>
                            <div class="col-sm-3">
                                <input id="ssxy" type="text" name="teashu" required placeholder=""
                                       class="form-control">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <br>
                        <div class="form-group" id="laydate">
                            <label class="col-sm-2 control-label">借用开始时间</label>
                            <div class="col-sm-3">
                                <input type="text" name="starttime" required placeholder="yyyy-MM-dd HH:mm:ss"
                                       class="form-control"
                                       id="test1">
                            </div>

                            <label class="col-sm-2 control-label">借用结束时间</label>
                            <div class="col-sm-4">
                                <input type="text" name="endtime" required placeholder="yyyy-MM-dd HH:mm:ss"
                                       class="form-control"
                                       id="test2">
                            </div>
                        </div>
                        <br>
                        <!-- 	<div class="hr-line-dashed"></div> -->

                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">审批人</label>
                            <div class="col-sm-3">
                                <input id="fzr" type="text" name="fuzeren" required placeholder="请输入审批人姓名"
                                       class="form-control upd">
                            </div>

                            <label class="col-sm-2 control-label">审批通过时间</label>
                            <div class="col-sm-4">
                                <input type="text" name="endtime" required placeholder="yyyy-MM-dd HH:mm:ss"
                                       class="form-control"
                                       id="test3">
                            </div>
                        </div>


                        <div class="hr-line-dashed"></div>
                        <div class="form-group" id="tjj">

                        </div>
                        <!--                        返回功能-->
                        <div class="form-group">
                            <div class="col-sm-3 col-sm-offset-4">
                                <a target="_self" href="examine.html">
                                    <input type="submit"
                                           class="btn btn-info"
                                           value="返回">
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
                <script src="./layui/layui.js" type="text/javascript" charset="utf-8"></script>
                <script type="text/javascript">//----layui框架
                layui.use('laydate', function () {
                    var laydate = layui.laydate;
                    var nowTime = new Date();
                    var startTime = laydate.render({
                        elem: '#test1',
                        type: 'datetime',
                        btns: ['now', 'confirm'],
                        min: 0,
                        max: 60,
                        done: function (value, date, endDate) {
                            endTime.config.min = {//把结束时间的最小值改为开始时间
                                year: date.year,
                                month: date.month - 1,//关键
                                date: date.date,
                                hours: date.hours,
                                minutes: date.minutes,
                                seconds: date.seconds
                            };
                            var id2 = parseInt($("option:selected").prop('id'));
                            var starttime = value;
                            var endtime = $("input[name='endtime']").val();
                            if (id2 != "" && starttime != "") {
                                $("input[name='endtime']").removeAttr("disabled");
                                $.ajax({
                                    type: "POST",
                                    url: "/user/judgeStartTime",
                                    data: {
                                        "mid": id2,
                                        "starttime": starttime,
                                    },
                                    success: function (msg) {
                                        if (msg != ("true")) {
                                            // $.alert("温馨提示","时间冲突，请重新选择");
                                            layer.alert('时间冲突，请重新选择');
                                            $("input[name='starttime']").val("");
                                            $("input[name='endtime']").val("");
                                            $("input[name='endtime']").prop("disabled", true);
                                        }
                                        ;   // if(msg!=true){form.render();};
                                    },
                                    error: function (nn) {
                                        // $.alert("温馨提示","提交失败");
                                        layer.alert('提交失败');
                                    }
                                });
                            } else {
                                $("input[name='endtime']").prop("disabled", true);
                            }
                            ;//if结束
                        }//done结束
                    });

                    var endTime = laydate.render({
                        elem: '#test2',
                        type: 'datetime',
                        btns: ['now', 'confirm'],
                        min: 0,
                        max: 60,
                        done: function (value, date, endDate) {
                            //把开始时间的最大值改为结束时间的值
                            startTime.config.max = {
                                year: date.year,
                                month: date.month - 1,//关键
                                date: date.date,
                                hours: date.hours,
                                minutes: date.minutes,
                                seconds: date.seconds
                            };
                            //监听会议室时间是否冲涂，有借的吗
                            var id2 = parseInt($("option:selected").prop('id'));
                            var endtime = value;
                            var starttime = $("input[name='starttime']").val();
                            if (id2 != "" && starttime != "" && endtime != "") {
                                $.ajax({
                                    type: "POST",
                                    url: "/user/judgeTime",
                                    data: {
                                        "mid": id2,
                                        "starttime": starttime,
                                        "endtime": endtime,
                                    },
                                    success: function (msg) {
                                        // form.render();
                                        if (msg != ("true")) {
                                            layer.alert('时间冲突，请重新选择');
                                            $("input[name='endtime']").val("");
                                            $("input[name='starttime']").val("");
                                        }
                                        ;

                                    },
                                    error: function (nn) {
                                        layer.alert('提交失败');
                                    }
                                });
                            }
                            ;//if结束
                        }//done
                    });//test2
                });
                </script>
                <script src="js/jquery.min.js-v=2.1.4"
                        tppabs="http://www.zi-han.net/theme/hplus/js/jquery.min.js?v=2.1.4"></script>
                <script src="layui/layer/layer.js" type="text/javascript" charset="utf-8"></script>
                <script>//-----jquery框架-----
                let id = 0;
                let state = "";
                function sy() {
                    console.log(id, state);
                    let xx = "审批通过";
                    $.ajax({
                        type: "POST",
                        url: "/admin/changeDelayState",
                        data: {
                            id: parseInt(id),
                            state:xx
                        },
                        success: function (msg) {
                            console.log(msg)
                            $("#tjj").remove();
                            layer.alert("审批通过");
                        }
                    });
                }

                function sy2() {
                    console.log(id, state);
                    // let xx = "驳回请求";
                    $.ajax({
                        type: "POST",
                        url: "/admin/changeDelayState",
                        data: {
                            id: parseInt(id),
                            state:"未通过"
                        },
                        success: function (msg) {
                            $("#tjj").remove();
                            layer.alert("驳回请求");
                        }
                    });
                }

                <!--	获取url后边的参数-->
                function GetRequest() {
                    const url = location.search; //获取url中"?"符后的字串
                    let theRequest = new Object();
                    if (url.indexOf("?") != -1) {
                        let str = url.substr(1);
                        let strs = str.split("&");
                        for (let i = 0; i < strs.length; i++) {
                            theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
                        }
                    }
                    return theRequest;
                }


                $(document).ready(function ab() {
                    let x = GetRequest();
                    let delaysdate=''
                    console.log(x);
                    let idd = x.id;
                    delaysdate=x.delaystate
                    console.log(delaysdate)
                    id = idd;
                    $(".i-checks").iCheck({
                        checkboxClass: "icheckbox_square-green",
                        radioClass: "iradio_square-green",
                    });
                    console.log(parseInt(idd))
                    //所有输入框只读
                    $("#huoqumeeting").attr('disabled', true)
                    $("input").attr("readonly", "readonly")
                    //----获取会议室---
                    $.ajax({
                        type: "POST",
                        url: "/admin/getOneBorrow",
                        data: {
                            id: parseInt(idd)
                        },
                        success: function (msg) {
                            console.log(msg);
                            state = msg.state;
                            // $("#huoqumeeting").append(msg.midName);
                            $("#hys").val(msg.midName);
                            $('#hymc').val(msg.name);
                            $('#hynr').val(msg.text);
                            $('#test1').val(msg.starttime);
                            $('#test2').val(msg.endtime);
                            $('#chrs').val(msg.num);
                            $('#htsl').val(msg.micro_num);
                            $('#cbsl').val(msg.cup_num);
                            $('#szbf').val(msg.table_shape);
                            $('#nhld').val(msg.leader);
                            $('#jbr').val(msg.handler);
                            $('#fzr').val(msg.director);
                            $('#lxdh').val(msg.tel);
                            $('#gaba').val(msg.security);
                            $('#ssxy').val(msg.uname);
                            // console.log(msg.delaystate);
                            // console.log(delaysdate);
                            console.log(msg.state == "审批通过")
                            if (msg.state == "审批通过") {
                                let tjj = "<div id='pycg' class=\"col-sm-3 col-sm-offset-4\">\n" +
                                    "                                <input onclick='sy()' type='submit' style=\"margin-right: 40%;\" id=\"tijiao\" class=\"btn btn-primary\"\n" +
                                    "                                       value=\"批准\">\n" +
                                    "                                <input onclick='sy2()' type='submit' class=\"btn btn-white\" id=\"reset1\" value=\"拒绝\">\n" +
                                    "                            </div>";
                                $('#tjj').append(tjj);
                            }
                        }
                    });
                    //----结束---
                });
                </script>
                <script src="js/bootstrap.min.js-v=3.3.5"
                        tppabs="http://www.zi-han.net/theme/hplus/js/bootstrap.min.js?v=3.3.5"></script>
                <script src="js/content.min.js-v=1.0.0"
                        tppabs="http://www.zi-han.net/theme/hplus/js/content.min.js?v=1.0.0"></script>
                <script src="js/plugins/iCheck/icheck.min.js"
                        tppabs="http://www.zi-han.net/theme/hplus/js/plugins/iCheck/icheck.min.js"></script>
                <script type="text/javascript" src="../../../tajs.qq.com/stats-sId=9051096"
                        tppabs="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>

</body>
</html>
